<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('牛奶入库列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row" id="printArea">
        <div>
            <div>
                <form id="formId">
                    <!--  <div class="select-list">-->
                    <input hidden="hidden"  name="orderId" th:value="${orderId}"/>
                    <!--  </div>-->
                </form>
            </div>

        </div>

      <div class="btn-group-sm" id="toolbar" role="group">
          <h3>入库单号：&nbsp;&nbsp;<span th:text="${order.orderCode}"></span>&nbsp;&nbsp;入库时间:&nbsp;&nbsp;<span data-format="yyyy-MM-dd HH:mm:ss"  th:text="*{#dates.format(order.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>&nbsp;&nbsp;入库经手人:&nbsp;&nbsp;<span th:text="${order.createBy}"></span></h3>
     </div>
        <h3 align="center"> <span th:text="${order.orderCode}+牛奶入库单" id="ordercode" hidden="hidden"></span> </h3>

        <div class="col-sm-12 select-table table-striped">

            <table id="bootstrap-table" data-mobile-responsive="true"></table>
            <h3> <span class="fl-l" id="autograph" hidden="hidden"></span> </h3>
        </div>

        <div class="btn-group-sm" id="toolbar1" role="group">
            <a class="btn btn-warning" id="print-btn" orderType = "10" >
                <i class="fa fa-download"></i> 打印
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncInputChicken:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncInputChicken:remove')}]];
    var prefix = ctx + "system/ncInputMilk";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "牛奶入库",
            showExport: false,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            toolbar: 'toolbar1',
            sortName:'inputTime',
            sortOrder:'desc',
            columns: [
                /*{
                checkbox: true
                },*/
               /* {
                    field : 'inputId',
                    title : '序号',
                },*/
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'inputCode',
                    title : '牛奶批次',
                    sortable: true
                },
                {
                    field : 'inputAmout',
                    title : '入库数量（kg）',
                    sortable: true
                },
                /*{
                    field : 'leftAmout',
                    title : '剩余量',
                    sortable: true
                },
                {
                    field : 'bottleAmount',
                    title : '瓶数',
                    sortable: true
                },*/
                {
                    field : 'milkmanName',
                    title : '挤奶人员'
                },
                {
                    field : 'disinfectorName',
                    title : '消毒人员'
                },
                {
                    field : 'inputTime',
                    title : '入库时间',
                    sortable: true
                },
                /*{
                    field : 'inputType',
                    title : '入库类型 ：字典',
                    sortable: true
                },*/
                {
                    field : 'inputUserName',
                    title : '入库经手人'
                },
                /*{
                    field : 'createBy',
                    title : '创建者',
                    sortable: true
                },
                {
                    field : 'createTime',
                    title : '创建时间',
                    sortable: true
                },*/
                {
                    field : 'remark',
                    title : '备注',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.inputId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.inputId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);

    });
    /*表单确认*/
    function confirmTable() {
        var confirmTable = prefix + "/confirmTable";
        var data = $('#bootstrap-table').bootstrapTable('getData');
        if (data && data.length > 0) {

            $.modal.confirm("确认生成订单吗？", function () {
                var ids = [];
                $(data).each(function (i, e) {
                    ids.push(e.inputId);
                });
                var ids_str = ids.join(",");
                myPost(confirmTable, {ids: ids_str},
                    function (data) {

                        if (data.code == 0) {
                            layer.msg("提交成功")
                        } else {
                            layer.msg(data.msg);
                        }
                        reload()
                    }, function (e) {
                        layer.msg("确认失败!");
                        reload()
                    })

            })
        } else {
            layer.msg("未发现数据!")
        }

    }
    /*打开检测记录单*/
    function openOrder() {

        var url = ctx + 'system/ncOrder?orderType=12 ';

        $.modal.openTab("检测记录单", url);
    }
    function reload() {
        window.location.reload()
    }
</script>
</body>
</html>